//
//  ViewController.swift
//  iOS开发基础知识点
//
//  Created by zhaoguoteng on 2020/5/25.
//  Copyright © 2020 zhaoguoteng. All rights reserved.
//

import UIKit

extension NSNotification.Name {
    
   public static let test = NSNotification.Name(rawValue: "test")
}

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        NotificationCenter.default.addObserver(self, selector: #selector(test), name: .test, object: nil)
        
    }

    @objc
    func test() {
        
        var sum = 0
        for i in 0 ..< 10000000 {
            sum += i
        }
        
        print("######## sum = \(sum)")
    }
}

